﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Xml.Serialization;

namespace Confessor
{
        [XmlRootAttribute("ScanObject", Namespace="", IsNullable=false)]
    public class ScanObject
    {
        public ScanObject()
        {
        }

            // For xml serialization
            [XmlAttributeAttribute(DataType = "date")]
        public System.DateTime DateTimeValue;

        // Confessor Case Information
        public string InvestigationID { get; set; }
        public string ConfessorSharePath { get; set; }
        public string ResultsSharePath { get; set; }
        public string ResultsDirectory { get; set; }
        public string WMICreateProcess { get; set; }

            // Do not serialize (save) the username and password...
            [XmlIgnoreAttribute()]
        public string UserName { get; set; }
            [XmlIgnoreAttribute()]
        public string Password { get; set; }

        // Scan Type
        public bool PsExec = false;
        public bool PsExecAsSystem = false;
        public bool WMIShares = false;
        public bool WMIFileCopy = false;
        public bool WMITestCreateProcess = false;
        public int AllowedMinutesPerHost { get; set; }

        //UserDefined File items.
        public string customFile1 { get; set; }
        public string customFile2 { get; set; }
        public string customFile3 { get; set; }
        public bool FileExists = false;
        public bool FileExistsSystem = false;
        public bool FileOwner = false;
        public bool FileCopy = false;

        //UserDefined RegKey items.
        public string customRegKey1 { get; set; }
        public string customRegKey2 { get; set; }
        public string customRegKey3 { get; set; }
        public bool RegKeyValues = false;
        public bool RegKeyCopy = false;

        // List of hosts
        //XML Host Array
            [XmlArray(ElementName = "Hosts", Namespace = "", IsNullable = false)]
        public BindingList<ConfessorHostObject> Hosts = new BindingList<ConfessorHostObject>();
        // List of errors from the scan... if any :)
        //XML Error Array
            [XmlArray(ElementName = "ScanErrors", Namespace = "", IsNullable = false)]
        public BindingList<ScanErrorObject> Errors = new BindingList<ScanErrorObject>();
            [XmlArray(ElementName = "TreeViewNodes", Namespace = "", IsNullable = false)]
        public List<string> treeViewNodesList = new List<string>();
    }

    //Info for the hosts
    public class ConfessorHostObject
    {
            [XmlElement(ElementName = "Host")]
        public string IP { get; set; }
        public string HostName { get; set; }
        public string Status { get; set; }
        public DateTime ScanStartTime { get; set; }
        public DateTime ScanFinishedTime { get; set; }
        public TimeSpan ElapsedTime { get; set; }
    }

    public class ScanErrorObject
    {
            [XmlElement(ElementName = "ScanError")]
        public string HostName { get; set; }
        public string ConfessorFailure { get; set; }
        public string Error { get; set; }
    }
}